package ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

public class EditTodoWindow extends AbstractTodoWindow{
	
	private JButton deleteButton;
	
	public EditTodoWindow(MainWindow mw) {
		super(mw);
		deleteButton = new JButton("Delete");
		deleteButton.setBounds(61, 260, 87, 23);
		
		deleteButton.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				EditTodoPresenter etp = (EditTodoPresenter)presenter;
				etp.deleteButtonClicked();
			}
			
		});
		
		getContentPane().add(deleteButton);
		// TODO Auto-generated constructor stub
	}

	@Override
	protected AbstractTodoPresenter createPresenter() {
		// TODO Auto-generated method stub
		return new EditTodoPresenter(this);
	}
	
	public void setData(String title, String description, String start,
			String end) {
		titleField.setText(title);
		descriptionArea.setText(description);
		startField.setText(start);
		endField.setText(end);
	}

	@Override
	protected String myTitle() {
		return "Edit todo";
	}
	
	@Override
	public EditTodoPresenter getPresenter() {
		return (EditTodoPresenter) presenter;
	}

}
